//
// Created by Administrator on 2022/11/15.
//

#include "http_req_rep_com.h"
char* get_http_mime_type(const char* name) {
    const char* dot = strrchr(name, '.');
    if(dot == NULL){
        return "text/plain; charset=utf-8";
    }
    if(strcmp(dot, ".html") == 0 || strcmp(dot, "htm") == 0)
        return "text/html; charset=utf-8";
    if(strcmp(dot, ".jpg") == 0 || strcmp(dot, "jpeg") == 0)
        return "image/jpeg";
    if(strcmp(dot, ".pdf") == 0)
        return "application/pdf";
    if(strcmp(dot, ".mp3") == 0)
        return "audio/mp3";
    if(strcmp(dot, ".mp4") == 0)
        return "video/mpeg4";
    return "text/plain; charset=utf-8";
}